﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using WpfSnqkGasAnalysis.Common;
using WpfSnqkGasAnalysis.Model;

namespace WpfSnqkGasAnalysis
{
    /// <summary>
    /// 审核按钮，判断是否显示
    /// </summary>
    /// 创建时间：2022-12-9 15:52:20。作者：王浩力
    internal class Gas_analysis_o_stepCheckConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (int.TryParse(value.ToString(), out int o_step))
            {
                if (o_step == 2 
                    &&
                    (GetLoginHelpter.CurrentLoginUser().Role_id== "审核人"
                      //超级账号
                    || GetLoginHelpter.CurrentLoginUser().User_account.Equals(CommonConfig.SupperUserAccount)
                    )
                 )
                {
                    return System.Windows.Visibility.Visible;
                }
                return System.Windows.Visibility.Collapsed;
            }
            return System.Windows.Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
